'use strict';
const Service = require('egg').Service;
const Controller = require('egg').Controller;
const svgCaptcha = require('svg-captcha')
class RootController extends Controller {
    async deluser(){
		let ziduan=this.ctx.request.query
		// console.log(ziduan)
		let sql=`DELETE FROM goods WHERE id=${ziduan.id}`
		let res=await this.ctx.app.mysql.query(sql)
		this.ctx.body=res
		
	}
	
	async update1(){
		let ziduan=this.ctx.request.query
		// console.log(ziduan)
		let sql=`UPDATE goods SET img="${ziduan.img}",title="${ziduan.title}",updata="${ziduan.updata}",type="${ziduan.type}",type1="${ziduan.type1}",type2="${ziduan.type2}",detail="${ziduan.detail}",zhanghao="${ziduan.zhanghao}",mima="${ziduan.mima}",pingjia="${ziduan.pingjia}"  WHERE id=${ziduan.id};`
		
		// let sql=`UPDATE goods SET title="${ziduan.title}",updata="${ziduan.updata}",type="${ziduan.type}"  WHERE id=${ziduan.id};`
		let res=await this.ctx.app.mysql.query(sql)
		
		this.ctx.body=res
	}

	async xjuser(){
		let ziduan=this.ctx.request.query
		console.log(ziduan)
		// let sql=`INSERT INTO goods VALUES(id=="${ziduan.id}",title="${ziduan.title}",updata="${ziduan.updata}",type="${ziduan.type}");`
		let sql=`INSERT  INTO goods  VALUES("${ziduan.id}", "${ziduan.img}","${ziduan.title}","${ziduan.updata}","${ziduan.type}","${ziduan.type1}","${ziduan.type2}","${ziduan.detail}","${ziduan.zhanghao}","${ziduan.mima}","${ziduan.pingjia}","hello","asd","asd","asd",0)`;

		let res=await this.ctx.app.mysql.query(sql)
		
		this.ctx.body=res
	}

}

module.exports = RootController;